package com.ymatou.query.trading.api.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.experimental.categories.Category;

import com.ymatou.query.trading.api.parameter.GetCouponInfoBean;
import com.ymatou.query.trading.api.service.GetCouponInfoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.utils.constant.ECode;

/**
 * 获取优惠券信息 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_GetCouponInfo {

	private static GetCouponInfoBean getcouponinfobean;
	private static GetCouponInfoCall getcouponinfocall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取优惠券信息");
	}

	@Before
	public void caseUp() {

		getcouponinfobean = new GetCouponInfoBean();
		getcouponinfocall = new GetCouponInfoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getcouponinfocall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	//@Test 废弃
	@Category(P1.class)
	@TestCase
	public void Tc_GetCouponInfo_001() {
		Logger.start(true,"获取优惠券信息成功");
		try {
			// 参数
			getcouponinfobean.setOrderId(105248424);
			// 发送请求
			getcouponinfocall.setData(getcouponinfobean);
			getcouponinfocall.callService();
			Logger.comment("getcouponinfocall send:" + getcouponinfocall.getEntityString());
			Logger.comment("getcouponinfocall response:" + getcouponinfocall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS, getcouponinfocall.getCode(), "验证Code");
			// Logger.verifyEquals(ErrorCode.SUCCESSMSG,
			// getcouponinfocall.getMsg(), "验证Msg");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getCouponCode(), "验证CouponCode");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getCouponTitle(), "验证CouponTitle");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getCouponUseType(), "验证CouponUseType");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getCouponType(), "验证CouponType");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getCouponGetTime(), "验证CouponGetTime");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getRemainingNum(), "验证RemainingNum");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getMinTotalAmount(), "验证MinTotalAmount");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getCouponAmount(), "验证CouponAmount");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getCouponSettingId(), "验证CouponSettingId");
			Logger.verifyNotNull(getcouponinfocall.getCouponInfo().getCouponVaildBeginDate(), "验证CouponVaildBeginDate");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}